import img404 from '@$@/img/img404.gif';
import $app from '@$@/js/$app';
import $router from '@/router'

let colA = {
  list(that){
    let out=[
      {
        title: " ",
        type: "index",
        width: 30,
        align: "center ",
        className: "goOnTxt c999"
      },
      {
        type: "selection",
        className: "goOnTxt",
        align: "center",
        width: 40
      },
      {
        title: "图样",
        align: "center",
        width: 100,
        className: "goOnTxt",
        render: (h, params) => {
          let {
            row: { trademark_img }
          } = params;
    
          let out = h("img", {
            class: `f_12 contain inlineBlock padding5 pointer`,
            attrs: {
              src: trademark_img
            },
            style: {
              width: `${`80px`}`,
              height: `${`60px`}`
            },
            on: {
              error: event => {
                event.target.src = img404;
              },
              click: () => {
                $app.imgBoxSee(trademark_img);
              }
            }
          });
    
          return out;
        }
      },
      {
        title: "商标名称",
        key: "trademark_name",
        className: "goOnTxt",
        resizable: true,
      },
      {
        title: "注册号",
        className: "goOnTxt",
        width: 120,
        resizable: true,
        render: (h, params) => {
          let {
            row: { inter_type, register_number }
          } = params;
    
          let out = h("span", {
            class: `cBlue textLine`,
            on: {
              click: () => {
                // 页面跳转
                $router.push({
                  name: 'TrademarkInfo',
                  query: {
                    p1: inter_type,
                    p2: register_number
                  }
                })
              }
            }
          }, register_number);
    
          return out;
        }
      },
      {
        title: "类别",
        align: "center",
        width: 60,
        className: "goOnTxt",
        key: "inter_type",
        resizable: true,
      },
      {
        title: "导入日期",
        align: "center",
        width: 100,
        sortable: 'custom',//如果设置为 custom，则代表用户希望远程排序
        sortType:(that.order=='created_at')?that.order_type:'',
        className: "goOnTxt",
        key: "created_at",
        resizable: true,
      },
      {
        title: "申请日期",
        align: "center",
        width: 100,
        sortable: 'custom',//如果设置为 custom，则代表用户希望远程排序
        sortType:(that.order=='apply_date')?that.order_type:'',
        className: "goOnTxt",
        key: "apply_date",
        resizable: true,
      },
      {
        title: "状态",
        key: "state_name",
        align: "center",
        width: 110,
        className: "goOnTxt",
        resizable: true,
      },
      {
        title: "申请人",
        key: "register_people_chinese_name",
        className: "goOnTxt",
        resizable: true,
        render: (h, params) => {
          let {
            row:{
              register_people_chinese_name,
            }
          } = params;
          let out = [
            h(
              "span",
              {
                class: " cBlue pointer",
                on:{
                  click:()=>{
                    $app.closeHadPage("Trademarklists", () => {
                      // 页面跳转
                      $router.push({
                        name: "Trademarklists",
                        query: {
                          query_key:register_people_chinese_name,
                          type: 3
                        }
                      });
                    });
                  }
                }
              },
              register_people_chinese_name
            )
          ];
  
  
  
          return out;
        }
      },
      {
        title: "数据来源",
        key: "source_name",
        width: 150,
        className: "goOnTxt",
        resizable: true,
      },
      {
        title: "操作",
        className: "goOnTxt",
        render: (h, params) => {
          let {
            row: {
              need_renewal,//0无续展，1续展，2宽展
              objection_count,//可异议的数量 需大于1
              trademark_name,
              register_number,
            }
          } = params;
          let out = [];
    
          if(need_renewal > 0){
            out.push(
              h(
                "span",
                {
                  class: "  marginR10  cBlue textLink" ,
                  on: {
                    click: () => {
                      if (need_renewal > 0) {
                        that.$refs['Temp'].trademark_name = trademark_name;
                        that.$refs['Temp'].register_number = register_number;
                        that.$refs['Temp'].remark = '';
                        that.$refs['Temp'].awayShop(202, '续 展');
                      }
                    }
                  }
                },
                `续展`
              )
            );
          }
          
    
          if(objection_count > 0){
            out.push(
              h(
                "span",
                {
                  class: "  marginR10 cBlue textLink ",
                  on: {
                    click: () => {
                      if (objection_count > 0) {
                        that.$refs['Temp'].trademark_name=trademark_name;
                        that.$refs['Temp'].register_number=register_number;
                        that.$refs['Temp'].remark='';
                        that.$refs['Temp'].awayShop(207,'异 议');
                      }
      
                    }
                  }
                },
                `异议`
              )
            );
          }

          if(!$app.judgeData(out)){
            out=[
              h(
                "span",
                {
                  class: "cCCC",
                  on: { }
                },
                ` - `
              )
            ];
          }
          
    
          return out;
        }
      }
    ];
    return out;
  }
}

// 表格 列 配置
export default colA;